<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
				var cities = [];
				cities["辽宁"] = ["沈阳","大连","盘锦"];
				cities["吉林"] = ["吉林","长春","四平"]; 
				cities["黑龙江"] = ["哈尔滨","黑河","漠河"];
				
				function getCity(){
					var provinceName = document.getElementById("province").selectedOptions[0].innerText;
					
					var city = document.getElementById("city");
					city.options.length = 1;//清空之前的选择
					
					if(provinceName != "请选择"){
					for(i < 0; i < cities[provinceName].length;i++){
						var option = new Option(cities[provinceName][i],i+1);
						city.options.add(option);
					}
					}
					// var province = document.getElementById("province").value;
					// var city ;
					// var option;
					// city = document.getElementById("city");
					// city.options.length = 1;//清空之前的选择
					// // cities[province-1]
					
					// for(i = 0; i <cities[province-1].length;i++ ){
					// 	var option = new Option(cities[province-1][i],i+1);
					// 	city.options.add(option);
					// }
				}
			</script>
		</head>
		<body>
			省份:
			<select id="province" onchange="getCity()">
				<option value="0">请选择</option>
				<option value="1">辽宁</option>
				<option value="2">吉林</option>
				<option value="3">黑龙江</option>
			</select>
			城市:
			<select id="city">
				<option value ="0">请选择</option>
			</select>
		</body>
</html>
